package com.gitee.gphomework.pattern.commandpattern.invoker;

import com.gitee.gphomework.pattern.commandpattern.command.IFtpCommand;
import com.gitee.gphomework.pattern.commandpattern.command.PassCommand;
import com.gitee.gphomework.pattern.commandpattern.command.UserCommand;
import com.gitee.gphomework.pattern.commandpattern.receiver.FtpCmdReceiver;

import java.util.ArrayList;
import java.util.List;

/**
 * Created on 2020/3/18
 * Title: 基础Ftp功能客户端
 * Description: 基础Ftp功能客户端
 * Copyright: Copyright(c) 2020
 * Company:
 *
 * @author yifeng
 */
public class FtpBaseClient {

    private List<IFtpCommand> commands;

    public FtpBaseClient() {
        commands = new ArrayList<>(2);
        commands.add(new UserCommand(FtpCmdReceiver.getInstance()));
        commands.add(new PassCommand(FtpCmdReceiver.getInstance()));
    }

    /**
     * 初始化Ftp链接
     */
    public void initFtpConnection() {
        commands.forEach(IFtpCommand::execute);
    }

}
